﻿<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf8">

<SCRIPT LANGUAGE="JavaScript">

name_month=new Array ("января","февраля","марта", "апреля","мая", "июня","июля","августа","сентября", "октября","ноября","декабря");
name_day=new Array ("воскресенье","понедельник", "вторник","среда","четверг", "пятница","суббота");

function wr_hours()
{
	time=new Date();

	time_sec=time.getSeconds();
	time_min=time.getMinutes();
	time_hours=time.getHours();
	time_wr=((time_hours<10)?"0":"")+time_hours;
	time_wr+=":";
	time_wr+=((time_min<10)?"0":"")+time_min;
	time_wr+=":";
	time_wr+=((time_sec<10)?"0":"")+time_sec;
	time_wr=name_day[time.getDay()]+", "+time.getDate()+" "+name_month[time.getMonth()]+" "+time.getFullYear()+" г. время "+time_wr;

	obj_hours=document.getElementById("hours");
	obj_hours.innerHTML=time_wr;
}

function checkForNoEnter()
{
	if (document.getElementById("id_stat_pas").style.display == '')
		showForm(false);
}

function showForm(visibl)
{
	document.getElementById("id_stat").style.display = 'none';	
	document.getElementById("id_stat_pas").value = '';

	if (visibl == true)
	{
		document.getElementById("id_stat_pas").style.display = '';
		document.getElementById("btn_get_stat").style.display = '';

		setTimeout("checkForNoEnter();", 30000);
	}
	else
	{
		document.getElementById("id_stat_pas").style.display = 'none';
		document.getElementById("btn_get_stat").style.display = 'none';
	}
}

function getStat()
{
	var req = false;

	function reqComplete()
	{
		if (req.readyState == 4)
		{
			if (req.status == 200)
			{
				document.getElementById("id_stat").innerHTML = req.responseText;
			}
			else if (req.status == 500)		//server fault!!!
			{
				document.location = './index.htm';
			}
			//timer set to hide result span!
			setTimeout("showForm(false);", 5000);
		}
	}

	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (req)
	{
		var pass = document.getElementById("id_stat_pas").value;
		if (pass.length == 0)
			return;

		showForm(false);

		document.getElementById("id_stat").style.display = '';
		document.getElementById("id_stat").innerHTML = 'ожидание ответа...';

		req.open("POST", "/get_stat?id=" + Math.random(), true);
		req.onreadystatechange = reqComplete;
		req.send('pass='+pass);
	}
}

</SCRIPT>

</head>
<body bgcolor="white" onLoad="wr_hours();setInterval('wr_hours();',1000);">
<table align="center" border="0" cellpadding="2" cellspacing="2" width="100%">
<tr>
<td width="33%"><b>Дата:   <span id="hours"> </span>
</b> </td>
<td width="33%"><b>Адрес: &nbsp; %ADDRESS%</b></td></td>
<td width="33%"><b>Техническая Поддержка:&nbsp; %PHONE%</b></td>
 </tr>

<tr><td> </td><td><br>
 <a href="/quit" target="_parent"><img src="./images/pic_1.png" border="0" width="20" height="20"></a> &nbsp;  &nbsp; 
 <a href="/" target="_parent"><img src="./images/pic_1.png" border="0" width="20" height="20"></a> &nbsp; 
<a href="/settings.htm" target="_parent"><img src="./images/pic_2.png" border="0" width="20" height="20"></a> &nbsp; 
<a href="#" onClick="showForm(true); "><img src="./images/pic_3.png" border="0" width="20" height="20"></a> &nbsp; &nbsp; &nbsp; 
<input type="password" name="stat_pas" id="id_stat_pas" style="display:none;"> &nbsp; <input type="button" value="получить!" id="btn_get_stat" style="display:none;" onClick="getStat();">
<span id="id_stat" style="display:none;">243</span>
</td><td> </td></tr>
</table>
</body>
</html>
